package com.neusoft.neuiotms.dcvm.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.Length;

import com.neusoft.bizcore.web.jpa.model.AbstractModel;
import com.neusoft.neuiotms.dcvm.enums.DictionaryType;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@Entity
@Table(name = "dcvm_dictionary")
public class Dictionary extends AbstractModel {

    private static final long serialVersionUID = 1L;

    /** 编码 */
    @NotBlank(message = "编码不能为空")
    @Length(max = 255, message = "编码不能超过{max}位")
    @Column(length = 255, nullable = false)
    private String code;

    /** 文本 */
    @NotBlank(message = "文本不能为空")
    @Length(max = 255, message = "文本不能超过{max}位")
    @Column(length = 255, nullable = false)
    private String text;

    private int sort = 0;

    @NotNull(message = "字典类别不能为空")
    @Enumerated(EnumType.STRING)
    private DictionaryType type;

}
